package cn.lexi.vip.config.http;

import org.asynchttpclient.AsyncHttpClientConfig;
import org.asynchttpclient.DefaultAsyncHttpClient;
import org.asynchttpclient.DefaultAsyncHttpClientConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author Aaron
 */
@Configuration
public class HttpConfig {

    // TODO 写一个注解类
    @Bean(name = "httpClient")
    public org.asynchttpclient.AsyncHttpClient getClient() {
        AsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder()
                .setMaxConnections(1)
                .build();
        return new DefaultAsyncHttpClient(config);
    }

}
